import Vue from 'vue'
import Vuex from 'vuex'

Vue.use(Vuex)

const store = new Vuex.Store({
    state: {
        //在歌手列表页和详情页两个页面（组件）共享歌手的信息
      singer:{}
    },
    mutations: {
      saveSinger(state,singer){
          state.singer = singer
      }
    },
    actions:{
      saveSinger(context,singer){
          //提交（commit）mutations
          context.commit('saveSinger',singer);
      }
    }
  })
  export default store